home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / src.zoo / src / defs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-04-03  |  7.9 KB  |  242 lines

  1. /*                        Copyright (c) 1987 Bellcore
  2.  *                            All Rights Reserved
  3.  *       Permission is granted to copy or use this program, EXCEPT that it
  4.  *       may not be sold for profit, the copyright notice must be reproduced
  5.  *       on copies, and credit should be given to Bellcore where it is due.
  6.  *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  7.  */
  8. /*    $Header: defs.h,v 1.1 89/03/17 08:21:02 sau Exp $
  9.     $Source: /m1/mgr.new/src/RCS/defs.h,v $
  10. */
  11. static char    h_defs_[] = "$Source: /m1/mgr.new/src/RCS/defs.h,v $$Revision: 1.1 $";
  12.  
  13. /* defines for mgr */
  14.  
  15. /* configurable parameters */
  16. #include "defines.h"
  17.  
  18. #ifdef SYSV
  19. #define index        strchr
  20. #define rindex        strrchr
  21. #endif
  22.  
  23. #ifdef DEBUG
  24. extern char debug_level[];
  25. char *index();
  26. #define dprintf(x) \
  27.     if (debug && index(debug_level,'x')) fprintf
  28. #endif
  29.  
  30. /* macros -- for speed */
  31.  
  32. #ifdef FASTMOUSE
  33. #define MoUSE(a,b)     bit_blit(screen, a, b, 16,16, \
  34.                                BIT_SRC^BIT_DST, m_rop,0,0)
  35. #define MOUSE_ON(a,b)    (!mouse_on && (mouse_on=1, MoUSE(a,b)) )
  36. #define MOUSE_OFF(a,b)    ( mouse_on && (mouse_on=0, MoUSE(a,b)) )
  37. #else
  38. /* turn on the mouse only if it is off */
  39. #define MOUSE_ON(a,b)     (!mouse_on && ( \
  40.                   mouse_on=1, \
  41.                       bit_blit(&mouse_save,0,0,16,16, \
  42.                     BIT_SRC,screen,a,b), \
  43.                   bit_blit(screen,a,b,16,16, \
  44.                     BIT_SRC|BIT_DST,m_rop,0,0), \
  45.                   bit_blit(screen,a,b,16,16, \
  46.                       BIT_NOT(BIT_SRC)&BIT_DST,m_rop,0,16) \
  47.                   ))
  48. /* turn off the mouse only if it is on */
  49. #define MOUSE_OFF(a,b)     (mouse_on && ( \
  50.                       mouse_on=0, \
  51.                       bit_blit(screen,a,b,16,16, \
  52.                     BIT_SRC,&mouse_save,0,0) \
  53.                       ))
  54. #endif
  55.  
  56. #define CLEAR(s,op)    bit_blit((s),0,0,BIT_WIDE(s),BIT_HIGH(s), \
  57.             op,0,0,0);
  58.  
  59. #define ACTIVE_ON() \
  60.             border(active,SUM_BDR-1,1), \
  61.             last_active = active!=last_active ? \
  62.               ( \
  63.               do_event(EVENT_DEACTIVATED,last_active,E_MAIN), \
  64.               do_event(EVENT_ACTIVATED,active,E_MAIN), \
  65.               active ) \
  66.             : \
  67.               last_active
  68.                    
  69. #define ACTIVE_OFF() \
  70.             border(active,BLK_BDR,WH_BDR)
  71.  
  72. #define SETMOUSEICON(x)    (m_rop = x)
  73.  
  74. /* short hand */
  75.  
  76. #define W(x)        (win->x)
  77. #define BETWEEN(a,x,b)    (x)<(a)?a:((x)>(b)?b:x)
  78. #define ACTIVE(x)    (active->x)
  79. #define ABS(x)        ((x)>0 ? (x) : -(x))
  80.  
  81. /* mouse buttons */
  82.  
  83. #define BUTTON_SYS    4        /* system menu */
  84. #define BUTTON_2    2        /* middle button (unused) */
  85. #define BUTTON_1    1        /* right button (vi?) */
  86.  
  87. /* Window table flags */
  88.  
  89. #define W_ACTIVE    0x000001L    /* Window is non_occluded */
  90. #define W_ESCAPE    0x000002L    /* An escape sequence is in progress */
  91. #define W_STOPPED    0x000004L    /* Window is stopped ( unused ) */
  92. #define W_REVERSE    0x000008L    /* window is white on black */
  93. #define W_STANDOUT    0x000010L    /* window is in standout mode */
  94. #define W_DIED        0x000020L    /* window has died */
  95. #define W_EXPOSE    0x000040L    /* expose window upon shell output */
  96. #define W_BACKGROUND    0x000080L    /* permit obscured window to update */
  97. #define W_NOKILL    0x000100L    /* don't kill window upon exit */
  98. #define W_VI        0x000200L    /* temporary vi hack -- */
  99. #define W_TEXT        0x000400L    /* downloading text */
  100. #define W_NOINPUT    0x000800L    /* don't accept keyboard input */
  101. #define W_NOWRAP    0x001000L    /* don't auto wrap */
  102. #define W_OVER        0x002000L    /* overstrike mode */
  103. #define W_ABSCOORDS    0x004000L    /* use absolute coordinates */
  104. #define W_MINUS        0x008000L    /* negative coord value */
  105. #define W_SNARFABLE    0x000004L    /* ok to gather data into cut buffer */
  106. #define W_SNARFLINES    0x010000L    /* snarf only lines */
  107. #define W_SNARFTABS    0x020000L    /* change spaces to tabs in snarf */
  108. #define W_SNARFHARD    0x040000L    /* snarf even if errors */
  109. #define W_SNARFLAGS    (W_SNARFTABS | W_SNARFHARD | W_SNARFLINES)
  110. #define W_INHERIT    0x080000L    /* inherit menus and bitmaps */
  111. #define W_DUPKEY    0x100000L    /* duplicate key mode */
  112. #define W_NOBUCKEY    0x200000L    /* Buckey keys (i.e. "Left-<char>" and
  113.                     "Right-<char>") have no effect */
  114. #define W_CLIPDONE    0x400000L    /* clip list for background update valid
  115.                     */
  116.  
  117. #define W_LOOK \
  118.     (W_EXPOSE | W_BACKGROUND)    /* Window ready to accept data */
  119.  
  120. #define W_STATE \
  121.     (W_ESCAPE | W_TEXT)        /* terminal emulator states */
  122.  
  123. #ifdef CUT
  124. #define W_SAVE \
  125.     (W_REVERSE | W_STANDOUT | W_EXPOSE | W_BACKGROUND | \
  126.      W_VI | W_NOINPUT | W_NOWRAP | \
  127.      W_SNARFLAGS | \
  128.      W_OVER | W_ABSCOORDS)        /* savable flags */
  129. #else
  130. #define W_SAVE \
  131.     (W_REVERSE | W_STANDOUT | W_EXPOSE | W_BACKGROUND | \
  132.      W_VI | W_NOINPUT | W_NOWRAP | \
  133.      W_OVER | W_ABSCOORDS)        /* savable flags */
  134. #endif
  135.  
  136. #define INIT_FLAGS    W_BACKGROUND    /* default window creation flags */
  137.  
  138. /* Structure definitions */
  139.  
  140. typedef struct {    /* used for text regions */
  141.   int x,y,wide,high;
  142.   } rectangle;
  143.  
  144. typedef struct  {    /* some day */
  145.   int x,y;
  146.   } point;
  147.  
  148. typedef struct window {        /* primary window structure */
  149.   struct window *next;    /* next window */
  150.   struct window *prev;    /* previous window */
  151.   struct window *stack;    /* stack of saved window environments */
  152.   struct window *main;    /* main window (or 0 if main window ) */
  153.   struct window *alt;    /* alternate window ( 0 if none) */
  154.   BITMAP *border;    /* window + border */
  155.   BITMAP *window;    /* This is the window */
  156.   BITMAP *save;        /* pointer to window bit-image if inactive */
  157.   BITMAP *bitmap;    /* for use when downloading bitmaps */
  158.   BITMAP *bitmaps[MAXBITMAPS];    /* scratchpad space */
  159.   BITMAP *cursor;    /* bitmap of cursor (future; unused just now) */
  160.   struct font *font;    /* this is the font */
  161.   char *clip_list;    /* pointer to clip list for BG updates */
  162.  
  163.   rectangle text;    /* location of text region within window */
  164.   int x0,y0;        /* origin of window on screen */
  165.   int x,y;        /* cursor character position */
  166.   int gx,gy;        /* graphics cursor */
  167.   int op;        /* raster op function (see bitmap.h)  */
  168.   int style;        /* character style normal/inverse video */
  169.   int background;    /* background color WOB or BOW */
  170.   int curs_type;    /* cursor type */
  171.  
  172.   int esc_cnt;        /* # of escape digits entered */
  173.   int esc[MAXESC];    /* escape array (as in ESCnn,nnm) */
  174.   int code;        /* code for text function */
  175.   char dup;        /* char to duplicate from keyboard */
  176.  
  177.   struct menu_state *menus[MAXMENU];    /* menus */
  178.   short menu[2];    /* index into menus for current button 1&2 menu */
  179.   long event_mask;    /* event mask  (see event.h) */
  180.   char *events[MAXEVENTS];    /* place for event strings */
  181.   char *snarf;            /* temporary snarf buffer */
  182.  
  183.   unsigned long flags;        /* misc. window flags (see defines above) */
  184.  
  185.   char buff[MAXSHELL];    /* shell input buffer */
  186.   int  max;        /* the # of chars in buff */
  187.   int  current;        /* the current char in buff */
  188.   int  to_fd;        /* file descriptor to shell */
  189.   int  from_fd;        /* file descriptor from shell */
  190.   int  pid;        /* process number of the shell */
  191.   int  setid;        /* window set id, 1..N, one per pid */
  192.   int  num;        /* window number ( for multiple window/proc) */
  193.             /* The window set id and the window number together
  194.             uniquely identify a window. */
  195.  
  196.   char tty[MAXTTY];    /* name of shell's tty */
  197.   } WINDOW;
  198.  
  199. typedef int (*function)();
  200. int new_window(), move_window(), destroy_window(), quit();
  201. int redraw();
  202. int sig_child(), catch();
  203.  
  204. /* static data items (described in data.c) */
  205.  
  206. extern short c_arrow1[];
  207. extern short c_box[];
  208. extern short pat_data[];
  209. extern char *full_menu[];
  210. extern char *main_menu[];
  211. extern char *active_menu[];
  212. extern char *test_menu[];
  213. extern char *quit_menu[];
  214. extern function full_functions[];
  215. extern function main_functions[];
  216. extern function active_functions[];
  217.  
  218. extern BITMAP *m_rop;
  219. extern int next_window;
  220. extern BITMAP pattern, mouse_box, mouse_arrow, mouse_cup, mouse_cross,mouse_cut;
  221. extern BITMAP mouse_save, mouse_not;
  222. extern struct font *font;
  223. extern BITMAP *screen;
  224. extern int mask;
  225. extern int poll;
  226. extern int rev_ops[];
  227. extern WINDOW *active;
  228. extern WINDOW *last_active;
  229. extern int button_state;
  230. extern mouse, mousex, mousey, mouse_on;
  231. extern int debug;
  232. extern char *fontlist[], *font_dir;
  233. extern char *icon_dir;
  234. extern char *snarf;
  235. extern char *message;
  236. extern char *start_command;
  237. extern char *init_command;
  238. extern int id_message;
  239. extern short buckey_map;
  240. extern unsigned int init_flags;
  241. extern char *version[];
  242.